<%--
  Created by IntelliJ IDEA.
  User: 步步为莹
  Date: 2019/9/18
  Time: 23:31
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="author" content="order by dede58.com"/><title>后台管理系统</title>
    <link rel="stylesheet" href="../../static/css/style.css">
    <link rel="stylesheet" href="../../static/css/jquery.wysiwyg.old-school.css">
    
    <!-- jQuery AND jQueryUI -->
    <script type="text/javascript" src="../../static/js/jquery.min.js"></script>
    <script type="text/javascript" src="../../static/js/jquery-ui.min.js"></script>
    <script type="text/javascript" src="../../static/js/min.js"></script>
    <!--<script type="text/javascript" src="js/index.js"></script>-->
</head>
<body class="modal white">
<script type="text/javascript" src="../../static/js/main.js"></script>
<link rel="stylesheet" href="../../static/css/style2.css">
<div id="content" class="white" style="margin-left:242px">
    <div class="bloc">
        <div class="title" style="margin-top:40px">新增员工</div>
        <div class="content">
            <form id="modify">
                <div class="input">
            <label>所属部门:</label>
                <select name="department">
                <option value="1001">工程部</option>
                <option value="1002">市场部</option>
                <option value="1003">开发部</option>
                <option value="1004">行政财务部</option>
                <option value="1005">客户服务部</option>
            </select></div>
                <div class="input">
                    <label for="login_name">登录名称:</label>
                    <input type="text" id="login_name" name="login_name">
                </div>
            <div class="input">
                <label for="real_name">真实姓名:</label>
                <input type="text" id="real_name" name="real_name">
            </div>
              <div class="input">
                  <label for="password">用户密码:</label>
                  <input type="password" id="password" name="password">
              </div>
            <div class="input">
                <label for="Email">Email:</label>
                <input type="text" id="Email" name="Email">
            </div>
            <div class="input">
                <label>联系电话:</label>
                <input type="text" id="tel" name="tel">
            </div>
           <div class="input">
               <label>用户性别:</label>
               <input type="radio"  name="sex" value="1" checked class="input radio">男&nbsp;&nbsp;
               <input type="radio"  name="sex" value="2" class="input radio">女
               </label>
           </div>
                <div class="input">
                    <label>员工职位:</label>
                    <select name="role">
                        <option value="1">自动化工程师</option>
                        <option value="2">程序员</option>
                        <option value="3">部门经理</option>
                        <option value="4">实施工程师</option>
                        <option value="5">运维工程师</option>
                    </select>
                </div>
              <div class="input">
                  <label for="address">联系地址:</label>
                  <input type="text" id="address" name="address">
              </div>
                <span onclick="commit()">新增</span>
                <input class="btn btn-danger" type="reset" id="reset" value="重置">
        </form>
        
        </div>
    </div>
</div>
<div id="ui-datepicker-div" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>
<script type="text/javascript">
    function commit() {
        var queryStr=$("form#modify").serialize();
        $.ajax({
            url:"<%=request.getContextPath()%>/userServlet",
            data:"opr=addUser&"+queryStr,
            dataType:"text",
            type:"POST",
            success:function (result) {
                console.log(result);
             if (result==="true"){
                 alert("添加员工成功！");
                window.location.href="employeemanage.jsp";
             }else {
                 alert("添加失败！");
               }
            }
        })
    }
</script>
</body>
</html>
